/**
 * interface
 * @author fanxueliang
 */

import {UnionSpecItem} from '@jsw/report-core';

type ShallowObjectType<T> = Record<string, T>;

export interface DatasourceType {
    label: string;
    value?: string;
}

export interface SpecAttrConfigType {
    label: string;
    component?: any;
    group?: string;
    attr?: {
        placeholder?: string;
        datasource?: DatasourceType[];
        clearable?: boolean;
    };
    items?: SpecAttrConfigType[];
    key?: string;
    path?: string;
}

export interface FlatSpecType {
    path: string;
    spec: UnionSpecItem;
    modifySpec?: any;
    isShow?: boolean;
    specConfig?: {
        attr: SpecAttrConfigType[];
        attrModel: ShallowObjectType<any>;
        extraAttr: SpecAttrConfigType[];
        extraAttrModel: ShallowObjectType<any>;
        rulesList: SpecAttrConfigType[];
        inRulesList: SpecAttrConfigType[];
        rulesMap: ShallowObjectType<SpecAttrConfigType>;
        rulesModel: ShallowObjectType<any>;
        addableRulesGroup: ShallowObjectType<SpecAttrConfigType>[];
        groupDatasource: DatasourceType[];
    };
}
